package com.fortune.rainshinecommon.alioss;


import com.aliyun.oss.OSSClient;


/**  
* @ClassName: MyOssClient  
* @Description: oss客户端（线程安全)
* @author 张鑫
* @phone 17561783855
* @date 2019年3月30日  
*    
*/
public class MyOssClient {
    private static String endpoint = "oss-cn-qingdao.aliyuncs.com";
    //内网模式(需要发布到阿里云才生效)
    //private static String endpoint = "oss-cn-beijing-internal.aliyuncs.com";
    private static String accessKeyId = "LTAIBGu2KFf5lwxK";
    private static String accessKeySecret = "PFV5nESUm6M9EGC19MuhS3IfUPCjhI";

    private MyOssClient() {

    }

    volatile private static OSSClient ossClient = null;

    public static OSSClient getOssClient() {
        if (ossClient != null) {}
        else {
            synchronized (MyOssClient.class) {
                if (ossClient == null) {
                    ossClient = new OSSClient(endpoint,accessKeyId,accessKeySecret);
                }
            }
        }
        return ossClient;
    }

    public static void shutdownOss(){
        ossClient.shutdown();
        ossClient=null;
    }


}
